using CfgTable;
using IQIGame.Onigao.Framework;
using IQIGame.Onigao.Game;

namespace IQIGame.Onigao.GamePlay
{
    /// <summary>
    /// 类名 : 界面数据 - 道具使用数据
    /// 作者 : Canyon / 龚阳辉
    /// 日期 : 2024-05-21 16:51
    /// 功能 : UIItemUse
    /// </summary>
    public class UD_ItemUse : UIBaseData
    {
        public virtual string strTitle { get; set; } = "";
        public virtual long itemSid { get; set; } = 0;
        public virtual int itemCid { get; set; } = 0;

        /// <summary>
        /// 每次改变数量
        /// </summary>
        public virtual int cntOnceChange { get; set; } = 1;

        public CfgItem cfgData => TableCenter.item.Get(this.itemCid);

        public UD_ItemUse Sync(string strTitle, long itemSid, int itemCid, int cntOnceChange = 1)
        {
            this.strTitle = strTitle;
            this.itemSid = itemSid;
            this.itemCid = itemCid;
            this.cntOnceChange = cntOnceChange;
            return this;
        }

        public void Clear()
        {
            this.strTitle = "";
            this.itemSid = 0;
            this.itemCid = 0;
            this.cntOnceChange = 1;
        }

        #region 对象池

        public override void OnReset()
        {
            this.Clear();
        }

        static public UD_ItemUse NewFromPool()
        {
            return ClassPool.Get<UD_ItemUse>();
        }
        #endregion
    }
}
